import RPi.GPIO as GPIO
def readLine(row_num, characters):

    C1 = 12
    C2 = 16
    C3 = 20
    C4 = 21
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BCM)
#    GPIO.setup(Dout, GPIO.OUT)
#    GPIO.setup(Din, GPIO.IN)
#    GPIO.setup(L1, GPIO.OUT)
#    GPIO.setup(L2, GPIO.OUT)
#    GPIO.setup(L3, GPIO.OUT)
#    GPIO.setup(L4, GPIO.OUT)
    GPIO.setup(C1, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(C2, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(C3, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(C4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) 
    g_col_list = [C1, C2, C3, C4]
    GPIO.output(row_num, GPIO.HIGH)    
    key = None
    for col in g_col_list:
        if GPIO.input(col) == 1:
            key = characters[ g_col_list.index(col) ]
            break
    GPIO.output(row_num, GPIO.LOW)
    return key